# coding=utf-8

import os
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '..'))

from db.SqlHelper import SqlHelper
from util.exception import Con_DB_Fail

try:
    sqlhelper = SqlHelper()
    sqlhelper.init_db()
except Exception:
    raise Con_DB_Fail

# proxy = {'ip': '192.168.1.1', 'port': int('90'), 'types': 0, 'protocol': 0, 'country': u'中国', 'area': u'四川', 'speed': 0}
# sqlhelper.insert(proxy)

# # proxy = {'ip': '192.168.1.1', 'port': 80, 'protocol': 0, 'country': '中国', 'area': '广州', 'speed': 11.123, 'types': ''}
# # sqlhelper.insert(proxy)
# sqlhelper.update({'ip': '192.168.1.1', 'port': 80}, {'score': 11})
# sqlhelper.delete({'ip': '192.168.1.1', 'port': 90})
print(sqlhelper.select())